Skip to content

improv(idempotency): mark getHashedIdempotencyKey() method as protected #3552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dreamorosi
Copy link
Contributor

Summary

Changes

Please provide a summary of what's being changed

This PR changes the access modifier of the getHashedIdempotencyKey() method in the packages/idempotency/src/persistence/BasePersistenceLayer.ts class so that customers can extend it and provide their own implementation for how the idempotency key is created.

import { DynamoDBPersistenceLayer } from '@aws-lambda-powertools/idempotency/dynamodb';
import type { JSONValue } from '@aws-lambda-powertools/commons/types';

class MyOwnPersistenceLayer extends DynamoDBPersistenceLayer {
  getHashedIdempotencyKey(data: JSONValue): string {
    return 'foo'; // this string will be used as idempotency key - use with caution
  }
}

// use MyOwnPersistenceLayer as you would DynamoDBPersistenceLayer

As with all the protected methods, you are free to extend the method in your own codebase but we don't guarantee stability of these methods.

Please add the issue number below, if no issue is present the PR might get blocked and not be reviewed

Issue number: closes #3540


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@dreamorosi dreamorosi self-assigned this Feb 4, 2025
@dreamorosi dreamorosi requested a review from a team February 4, 2025 08:31
@dreamorosi dreamorosi requested a review from a team as a code owner February 4, 2025 08:31
@boring-cyborg boring-cyborg bot added the idempotency This item relates to the Idempotency Utility label Feb 4, 2025
@pull-request-size pull-request-size bot added the size/XS PR between 0-9 LOC label Feb 4, 2025
Copy link

sonarqubecloud bot commented Feb 4, 2025

@github-actions github-actions bot added the enhancement PRs that introduce minor changes, usually to existing features label Feb 4, 2025
@dreamorosi dreamorosi merged commit 188b5b7 into main Feb 4, 2025
44 checks passed
@dreamorosi dreamorosi deleted the improv/dynamodb_get_hashed_idempotency_key_protected branch February 4, 2025 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement PRs that introduce minor changes, usually to existing features idempotency This item relates to the Idempotency Utility size/XS PR between 0-9 LOC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Be able to have more flexibility with how the idempotency key is being handled
2 participants